package org.fenixsoft.classloading;

/**
 * @program: jvm_test
 * @description:
 * @author: zxb
 * @date: 2020-12-26 17:13
 **/
public class DeadLoopClassTest {

    public static void main(String[] args) {
        Runnable script = new Runnable() {
            public void run() {
                System.out.println(Thread.currentThread() + " start");
                DeadLoopClass dlc = new DeadLoopClass();
                System.out.println(Thread.currentThread() + " run over");
            }
        };

        Thread t1 = new Thread(script);
        Thread t2 = new Thread(script);

        t1.start();
        t2.start();
    }

    /**
     * 运行结果如下，一条线程在死循环以模拟长时间操作，另外一条线程在阻塞等待
     * Thread[Thread-0,5,main] start
     * Thread[Thread-1,5,main] start
     * Thread[Thread-1,5,main] init DeadLoopClass
     */
}
